import React, { Component } from 'react';
import ProTypes from 'prop-types';
import router from 'umi/router';
import { Button, Col, Row } from 'antd';

import './index.less';
import { CODE_MESSAGE } from '@/utils/constants';

class $code extends Component {

  static proTypes = {
    code: ProTypes.number.isRequired,
    message: ProTypes.string.isRequired
  }

  render() {
    const { code } = this.props.match.params;

    return (
      <Row className='not-found'>
        <Col span={12} className='left'></Col>
        <Col span={12} className='right'>
          <h1>{ code }</h1>
          <h2>{ CODE_MESSAGE[code] }</h2>
          <div>
            <Button type='primary' onClick={() => router.replace('/')}>
              Back to Index
            </Button>
          </div>
        </Col>
      </Row>
    )
  }
}

export default $code;
